//
//  XiaoKaiUserCollectionView.m
//  Project_A
//
//  Created by 凯 on 15/7/21.
//  Copyright (c) 2015年 zhoukaidong. All rights reserved.
//

#import "XiaoKaiUserCollectionView.h"
#import "XiaoKaiBrand_detailsCollectionViewCell.h"
#import "XiaoKaiItemsConfigCollectionViewCell.h"
#import "DataBase.h"

@implementation XiaoKaiUserCollectionView




- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout
{
    self = [super initWithFrame:frame collectionViewLayout:layout];
    if (self) {
        self.delegate = self;
        self.dataSource = self;
        [self registerClass:[XiaoKaiItemsConfigCollectionViewCell class] forCellWithReuseIdentifier:@"usercollectionviewcell"];
 

    }
    return self;
}




-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    DataBase *dbManger = [DataBase shareInstance];
    [dbManger openDB];
    self.arr = [dbManger selectItemsInfo];
//    NSLog(@"大哥在这呢%@", self.arr);
    return self.arr.count;
}

-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    
    XiaoKaiItemsConfigCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"usercollectionviewcell" forIndexPath:indexPath];
    UserModel *model = self.arr[indexPath.row];
    cell.Model = model;
    return cell;
}

/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
